﻿

namespace SuperMarieApi.App.Controllers.Tool.Attribute
{
    public class AttributeTool
    {
        public static T GetClassAttribute<T,CT>() where CT:class 
        {
            object[] objAttrs = typeof(CT).GetCustomAttributes(typeof(T), true);
            T descAttr = (T)objAttrs[0];
            return descAttr;
        }

        public static T GetMethodAttribute<T, CT>(string methodName) where CT : class
        {
            object[] objAttrs = typeof(CT).GetMethod(methodName).GetCustomAttributes(typeof(T), true);
            T descAttr = (T)objAttrs[0];
            return descAttr;
        }
    }
}
